<template>
<div v-show="checked == 0" class="paydiv1">
    <div class="wechatpaydiv" @click="wechatpaybtn" :style="WAbtnstyle1">
        <img src="../../assets/icon/wechatpay.png" class="payimg">
        <span class="wechatalipaytext" :style="WAspanstyle1">微信支付</span>
    </div>
    <div class="alipaydiv" @click="alipaybtn" :style="WAbtnstyle2">
        <img src="../../assets/icon/alipay.png" class="payimg">
        <span class="wechatalipaytext" :style="WAspanstyle2">支付宝付款</span>
        
    </div>
</div>
</template>

<script>
export default {
    name:'XiaoPayAlipayWechatpay',
    data(){
        return{
            checked:99,
            WAbtnstyle1:'',
            WAbtnstyle2:'',
            WAspanstyle1:'',
            WAspanstyle2:'',
            WechatOrAli:'',
        }
    },
    methods:{
        wechatpaybtn(){
            this.WAbtnstyle1='border: 1px solid rgb(17, 216, 50);'
            this.WAspanstyle1='color: rgb(76, 146, 106);'
            this.WAbtnstyle2=this.WAspanstyle2=''
            this.WechatOrAli='wechat'
            this.$bus.$emit('WechatOrAli',this.WechatOrAli)
            
        },
        alipaybtn(){
            this.WAbtnstyle1=this.WAspanstyle1=''
            this.WAbtnstyle2='border: 1px solid rgb(91, 176, 255);'
            this.WAspanstyle2='color: rgb(76, 109, 146);'
            this.WechatOrAli='ali'
            this.$bus.$emit('WechatOrAli',this.WechatOrAli)
        }
    },
    mounted(){
        this.$bus.$on('TwoWayChecked',(TwoWayChecked)=>{
            this.checked=TwoWayChecked
        })
        this.$bus.$on('initialize',(initialize)=>{
            this.WAbtnstyle1=this.WAbtnstyle2=this.WAspanstyle1=this.WAspanstyle2=this.WechatOrAli=initialize
        })
    },
    beforeDestroy(){
        this.$bus.$off('TwoWayChecked')
        this.$bus.$off('initialize')
    },
}
</script>

<style scoped>
.paydiv1{
    margin: 0 auto;
    width: 1000px;
    margin-top: 10px;
    height: 100%;
}
.wechatpaydiv{
    cursor: pointer;
    border-radius: 8px;
    padding-top: 5px;
    padding-left: 15px;
    width: 140px;
    margin-top:50px;
    border: 1px solid rgb(170, 170, 170);
}
.alipaydiv{
    cursor: pointer;
    border-radius: 8px;
    padding-top: 5px;
    padding-left: 15px;
    width: 140px;
    margin-top:30px;
    border: 1px solid rgb(170, 170, 170);
}
.payimg{
    height: 30px;
    width: 30px;
}
.wechatalipaytext{
    color: rgb(153, 153, 153);
    margin-left: 10px;
    margin-top: 5px;
    position: absolute;
    font-size: 15px;
}
</style>